﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>集团计划</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="../../static/css/font.css" rel="stylesheet" />
    <link href="../../static/css/weadmin.css" rel="stylesheet" />
    <link href="../../../lib/layui/css/layui.css" rel="stylesheet" />
    <script src="../../../lib/layui/layui.js"></script>
</head>
<body>
    <div class="weadmin-nav">
        <span class="layui-breadcrumb" style="visibility: visible;">
            <a href="#">首页</a><span lay-separator="">/</span>
            <a href="#">培训计划</a><span lay-separator="">/</span>
            <a><cite>集团计划表</cite></a>
        </span>
        <a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
            <i class="layui-icon" style="line-height:30px">ဂ</i>
        </a>
    </div>
    <div class="layui-fluid" id="infos">
        <table id="dataList" lay-filter="dataList"></table>
    </div>
    <div class="layui-fluid fluid-position">
        <form class="layui-form">
            <div class="layui-card">
                <div class="layui-card-header">

                    <div class="layui-row layui-col-space10 layui-btn-container">
                        <button type="button" class="layui-btn layui-btn-primary" id="find" name="查询"><i class="layui-icon">&#xe615;</i>查询</button>
                        <button type="button" class="layui-btn layui-btn-primary" id="reset" name="清空"><i class="layui-icon">&#xe669;</i>清空</button>
                        <!--<button type="button" class="layui-btn layui-btn-normal" id="add" name="添加保存" lay-filter="add" lay-submit><i class="layui-icon">&#xe608;</i> 添加保存</button>-->
                        <button type="button" class="layui-btn layui-btn-normal" hidden="hidden" id="addupload" name="添加上传"><i class="layui-icon">&#xe608;</i> 添加上传</button>
                        <button type="button" class="layui-btn layui-btn-normal" id="edit" name="保存" lay-filter="edit" lay-submit><i class="layui-icon">&#xe642;</i>保存</button>
                        <button type="button" class="layui-btn layui-btn-danger" id="del" name="删除"><i class="layui-icon">&#xe640;</i>删除</button>
                        <button type="button" class="layui-btn layui-btn-warm" id="check" name="审核"><i class="layui-icon">&#xe605;</i>审核</button>
                        <button type="button" class="layui-btn layui-btn-warm" id="uncheck" name="取消审核"><i class="layui-icon">&#x1006;</i>取消审核</button>
                        <!--<button type="button" class="layui-btn layui-btn-warm layui-bg-cyan" name="发布" id="release"><i class="layui-icon">&#xe609;</i>发布</button>
                        <button type="button" class="layui-btn layui-btn-warm layui-bg-cyan" name="取消发布" id="unrelease"><i class="layui-icon">&#xe604;</i>取消发布</button>-->
                        <button type="button" class="layui-btn" onclick="importexcel()" name="导入"><i class="layui-icon">&#xe638;</i>导入</button>
                        <button type="button" class="layui-btn" name="导出"><i class="layui-icon">&#xe632;</i>导出</button>
                        <button type="button" class="layui-btn" name="打印"><i class="layui-icon">&#xe63c;</i>打印</button>
                    </div>
                </div>
                <div class="layui-card-body">
                    <div class="layui-collapse" lay-accordion lay-filter="infos_form">
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title">集团计划</h2>
                            <div class="layui-colla-content layui-show">
                                <!--<div class="layui-form">-->
                                <!--计划名称-->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">计划名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" placeholder="计划名称" id="CPName" name="CPName" class="layui-input" maxlength="50" />
                                    </div>
                                </div>

                                <!--时间-->
                                <div class="layui-form-item">
                                    <!--<label class="layui-form-label">计划编号</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="计划编号" class="layui-input" maxlength="8" />
                                    </div>-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">起始时间</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" id="StartDateTime" name="StartDateTime" />
                                        </div>
                                        <label class="layui-form-label layui-form-label-inner layui-form-label-inner-w1">至</label>
                                        <div class="layui-input-inline layui-form-label-inner">
                                            <input type="text" class="layui-input" id="EndDateTime" name="EndDateTime" />
                                        </div>
                                    </div>
                                </div>

                                <!--计划描述-->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">计划内容</label>
                                    <div class="layui-input-block">
                                        <textarea placeholder="计划内容" id="CPDescribe" name="CPDescribe" class="layui-textarea" maxlength="500"></textarea>
                                    </div>
                                </div>
                                <!--</div>-->

                                <div class="layui-form-item">
                                    <div class="layui-row">
                                        <button type="button" class="layui-btn layui-btn-primary" id="test8">选择文件</button>
                                        <label class="layui-form-label">上传附件</label>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="layui-card-header layui-btn-container">
                    <input type="hidden" value="" id="CPID" name="CPID" />
                    <input type="hidden" value="" id="IsCheck" name="IsCheck" />
                    <input type="hidden" value="" id="IsRelease" name="IsRelease" />
                </div>
            </div>
        </form>
    </div>
    <script>
        var selectIDs = [];//选中的id列表 [可用批量删除  审核 取消 ]
        var selectCurrentID = 0;// 当前选中的 id  [用于修改]
        var selectobjs = [];//
        function importexcel() {
            layer.open({
                type: 2,
                title: "集团计划上传",
                area: ['500px', '300px'],
                fixed: false, //不固定
                maxmin: true,
                content: './corpplan_upload.html',
                end: function () {
                    location.reload();
                }
            });
        }
        layui.use(['form', 'laydate', 'table', 'jquery', 'element', 'upload'], function () {
            var laydate = layui.laydate;
            var $ = layui.jquery;
            var th = $(document).height() * 0.5;
            var table = layui.table;
            var form = layui.form;
            var element = layui.element;
            var upload = layui.upload;
            $(".layui-card-header").find("button").each(function () { if (PowerList.indexOf($(this).attr("name")) <= -1) { $(this).attr("style", "display:none;") } });
            form.on('switch(switch)', function (data) { });
            laydate.render({
                elem: '#StartDateTime', trigger: 'click'
            });
            laydate.render({
                elem: '#EndDateTime', trigger: 'click'
            });
            function PageInit() {
                var obj = $("div[lay-id='dataList']");
                var child = $(".layui-table-body");
                var off = obj.offset().top;
                var c = th - off - 100;

                child.attr("style", "height:" + c + "px");
            }
            element.on('collapse(infos_form)', function (data) {
                PageInit();
            });
            function showList() {
                var swhere = JSON.stringify({ CPName: $("#CPName").val(), CPDescribe: $("#CPDescribe").val(), StartDateTime: $("#StartDateTime").val(), EndDateTime: $("#EndDateTime").val(), IsUse: "1" });
                table.render({
                    elem: '#dataList'
                    , url: ApiUrl + 'CorpPlan/Search'
                    , headers: {
                        "userid": JSON.parse(window.localStorage.authInfo).UserId,
                        "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                    },
                    page: true
                    , cols: [[
                        { type: 'checkbox' },
                        { field: 'CPID', title: '编号', sort: true, hide: true },
                        { field: 'CPName', title: '名称', width: 300 },
                        { field: 'CPDescribe', title: '内容' },
                        {
                            field: 'StartDateTime', title: '开始时间', width: 120, templet: function (d) {
                                return d.StartDateTime.substring(0, 10);
                            },
                        },
                        {
                            field: 'EndDateTime', title: '结束时间', width: 120, templet: function (d) {
                                return d.EndDateTime == null ? '' : d.EndDateTime.substring(0, 10);
                            },
                        },
                        { field: 'DesignUserName', title: '制订人', width: 100 },
                        { field: 'IsCheck', title: '审核', width: 100, templet: function (d) { return d.IsCheck == "0" ? "未审核" : "已审核" } },
                        {
                            field: 'AnnexName', title: '附件', width: 130, templet: function (d) {
                                return '<div><a href="' + DownUrl + d.AnnexUrl + '" class="layui-table-link">' + (d.AnnexName == null ? '' : d.AnnexName) + '</a></div>';
                            }
                        }
                    ]]
                    , where: { swhere: swhere }
                    , parseData: function (res) { //res 即为原始返回的数据
                        return {
                            "code": res.StatusCode, //解析接口状态
                            "msg": res.Info, //解析提示文本
                            "count": res.Count, //解析数据长度
                            "data": res.Data //解析数据列表
                        };
                    },
                    response: { statusCode: 200 },//规定成功的状态码，默认：0
                    event: true,
                    page: true,
                    done: function (res, curr, count) {
                        //如果是异步请求数据方式，res即为你接口返回的信息。
                        //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                        if (res.code == 403) {
                            layer.alert(res.msg, function () {
                                top.location.href = "http://" + top.location.host + "/login.html";
                            })
                        }
                    }
                });
            };
            showList();
            PageInit();
            function clearForm() {
                $("textarea").val("");
                $("input").val("");
            }
            //展示一条信息
            function GetSingleInfo(data) {
                $("#CPName").val(data.CPName);
                $("#CPDescribe").val(data.CPDescribe);
                $("#StartDateTime").val(data.StartDateTime.split('T')[0]);
                $("#EndDateTime").val(data.EndDateTime.split('T')[0]);
                $("#CPID").val(data.CPID);
                $("#IsCheck").val(data.IsCheck);
                $("#IsRelease").val(data.IsRelease);
            }

            ///按钮操作 开始
            //监听行单击事件（单击事件为：rowDouble）
            table.on('row(dataList)', function (obj) {
                var checked = false;
                var objcheck = $(obj.tr.selector).find("td").eq(0).find(".layui-table-cell").eq(0).find("div").eq(0);
                if (selectIDs.indexOf(obj.data.CPID) > -1) {
                    objcheck.removeClass("layui-form-checked");
                }
                else {
                    objcheck.addClass("layui-form-checked"); checked = true;
                }
                if (checked) {
                    if (obj.data.CPID != undefined) {
                        selectCurrentID = obj.data.CPID;
                        selectIDs.push(obj.data.CPID);
                        selectobjs.push(obj.data);
                        GetSingleInfo(obj.data);
                    }
                    else {
                        selectIDs = [];
                        selectCurrentID = 0;
                        selectobjs = [];
                        var dataList = table.checkStatus("dataList").data;
                        for (var i = 0; i < dataList.length; i++) {
                            var item = dataList[i];
                            selectobjs.push(item);
                            selectIDs.push(item.CPID);
                            if (i == dataList.length - 1) {
                                GetSingleInfo(item);
                                selectCurrentID = item.CPID;
                            }
                        }
                    }
                }
                else {
                    if (obj.data.CPID != undefined) {
                        selectIDs.splice(selectIDs.indexOf(obj.data.CPID), 1);
                        for (var i = 0; i < selectobjs.length; i++) {
                            if (selectobjs[i].CPID == obj.data.CPID) {
                                if (i == selectobjs.length - 1) {
                                    selectCurrentID = 0;
                                    selectCurrentName = "";
                                    if (i > 0) {
                                        if (selectobjs[i - 1].CPID != undefined) {
                                            selectCurrentID = selectobjs[i - 1].CPID;
                                            GetSingleInfo(selectobjs[i - 1]);
                                        }
                                    }
                                    else {
                                        clearForm(); selectCurrentID = 0;
                                    }
                                }
                                selectobjs.splice(i, 1);
                                break;
                            }
                        }
                    }
                    else {
                        selectIDs = [];
                        selectCurrentID = 0;
                        selectobjs = [];
                        clearForm();

                    }

                }
            });
            table.on('checkbox(dataList)', function (obj) {
                if (obj.data.AutoID == undefined) {
                    selectIDs = [];
                    selectCurrentID = 0;
                    selectobjs = [];
                    if (obj.checked) {
                        var dataList = table.checkStatus("dataList").data;
                        for (var i = 0; i < dataList.length; i++) {
                            var item = dataList[i];
                            selectobjs.push(item);
                            selectIDs.push(item.CPID);
                            if (i == dataList.length - 1) {
                                GetSingleInfo(item);
                                selectCurrentID = item.CPID;
                            }
                        }
                    }
                    else {
                        selectIDs = [];
                        selectCurrentID = 0;
                        selectobjs = [];
                        clearForm();
                    }
                }
            });


            $("#find").click(function () {
                showList();
            });


            $("#reset").click(function () {
                clearForm();
            });

            //取消添加保存，修改为添加保存同时上传一个文件
            ////添加保存
            //form.on('submit(add)', function (formdata) {
            //    console.log(JSON.stringify(formdata.field));//此处显示输入内容

            //    if ($("#CPName").val().trim() == "") {
            //        layer.msg("请输入计划名称！");
            //        return;
            //    }
            //    if ($("#StartDateTime").val().trim() == "") {
            //        layer.msg("请输入计划起始时间！");
            //        return;
            //    }
            //    if ($("#CPDescribe").val().trim() == "") {
            //        layer.msg("请输入计划描述！");
            //        return;
            //    }

            //    $.ajax({
            //        url: ApiUrl + "CorpPlan/Add",
            //        type: 'post',
            //        dataType: 'json',
            //        data: formdata.field,
            //        headers: {
            //            "userid": JSON.parse(window.localStorage.authInfo).UserId,
            //            "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
            //        },
            //        success: function (data) {
            //            if (data.StatusCode == 200 && data.Count != 0) {
            //                layer.alert(data.Info, { icon: 6 }, function (index) {
            //                    layer.close(index);
            //                    location.reload();
            //                })
            //            }
            //            else if (data.StatusCode == 403) {
            //                top.layer.alert(data.Info + ",请重新登录！", { closeBtn: 0 }, function () {
            //                    top.location.href = "http://" + top.location.host + "/login.html";
            //                })
            //            }
            //            else {
            //                layer.msg(data.Info);
            //            }
            //        }
            //    });
            //});

            //编辑保存
            form.on('submit(edit)', function (formdata) {
                if (selectCurrentID <= 0) {
                    add();
                }
                else {
                    edit();
                }
            });
            function edit()
            {
                //编辑保存 selectCurrentID
                var model = GetFormData();
                model.CPID = selectCurrentID;
                $.ajax({
                    url: ApiUrl + "CorpPlan/Edit",
                    type: 'post',
                    dataType: 'json',
                    data: model,
                    headers: {
                        "userid": JSON.parse(window.localStorage.authInfo).UserId,
                        "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                    },
                    success: function (data) {
                        if (data.StatusCode == 200 && data.Count != 0) {
                            cpid = data.Data;
                            $("#addupload").click();
                            layer.alert(data.Info, { icon: 6 }, function (index) {
                                layer.close(index); clearForm();
                                location.reload();
                            })
                        }
                        else if (data.StatusCode == 403) {
                            top.layer.alert(data.Info + ",请重新登录！", { closeBtn: 0 }, function () {
                                top.location.href = "http://" + top.location.host + "/login.html";
                            })
                        }
                        else {
                            layer.msg(data.Info);
                        }
                    }
                });

            }
            //删除
            $("#del").click(function () {

                if (selectIDs.length == 0) {
                    layer.msg("请选择要删除的计划！");
                    return;
                }

                layer.confirm('确定要删除吗,已审核或发布的将不会执行删除?', function (index) {


                    var delList = '';
                    for (var i = 0; i < selectIDs.length; i++) {
                        delList += selectIDs[i] + ',';
                    }

                    delList = delList.substring(0, delList.length - 1);

                    $.ajax({
                        url: ApiUrl + "CorpPlan/DelList",
                        type: 'get',
                        cache: false,
                        headers: {
                            "userid": JSON.parse(window.localStorage.authInfo).UserId,
                            "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                        },
                        data: { delidlist: delList },
                        success: function (data) {
                            if (data.StatusCode == 200) {
                                layer.alert(data.Info, { icon: 6 }, function (index) {
                                    layer.close(index);
                                    location.reload();
                                })
                            }
                            else if (data.StatusCode == 403) {
                                layer.alert(data.Info, function () {
                                    location.href = './login.html';
                                })
                            }
                            else {
                                layer.msg(data.Info);
                            }
                        }
                    });


                    //删除 selectIDs
                    layer.close(index);
                });
            });
            //审核
            $("#check").click(function () {
                //审核 selectIDs
                //alert("审核");

                if (selectCurrentID == 0) {
                    layer.msg("请选择要审核的计划！");
                    return;
                }
                if ($("#IsCheck").val() == "1") {
                    layer.msg("选择的计划已审核！");
                    return;
                }
                $.ajax({
                    url: ApiUrl + "CorpPlan/UpdatePlanStatus",
                    type: 'get',
                    cache: false,
                    headers: {
                        "userid": JSON.parse(window.localStorage.authInfo).UserId,
                        "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                    },
                    data: { mark: 'C', value: '1', wherevalue: selectCurrentID },
                    success: function (data) {
                        if (data.StatusCode == 200) {
                            layer.alert("审核成功", { icon: 6 }, function (index) {
                                layer.close(index);
                                location.reload();
                            })
                        }
                        else if (data.StatusCode == 403) {
                            layer.alert(data.Info, function () {
                                location.href = './login.html';
                            })
                        }
                        else {
                            layer.msg(data.Info);
                        }
                    }
                });

            });
            //取消审核
            $("#uncheck").click(function () {
                if (selectCurrentID == 0) {
                    layer.msg("请选择要取消审核的计划！");
                    return;
                }
                if ($("#IsCheck").val() == "0") {
                    layer.msg("选择的计划未审核！");
                    return;
                }

                layer.confirm('确定要取消审核吗?', function (index) {
                    //取消审核 selectIDs
                    //alert("已取消审核");


                    $.ajax({
                        url: ApiUrl + "CorpPlan/UpdatePlanStatus",
                        type: 'get',
                        cache: false,
                        headers: {
                            "userid": JSON.parse(window.localStorage.authInfo).UserId,
                            "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                        },
                        data: { mark: 'C', value: "0", wherevalue: selectCurrentID },
                        success: function (data) {
                            if (data.StatusCode == 200) {
                                layer.alert("取消审核成功", { icon: 6 }, function (index) {
                                    layer.close(index);
                                    location.reload();
                                })
                            }
                            else if (data.StatusCode == 403) {
                                layer.alert(data.Info, function () {
                                    location.href = './login.html';
                                })
                            }
                            else {
                                layer.msg(data.Info);
                            }
                        }
                    });


                    layer.close(index);
                });
            });
            //发布
            $("#release").click(function () {
                //alert("release");
                if (selectCurrentID == 0) {
                    layer.msg("请选择要发布的计划！");
                    return;
                }
                if ($("#IsRelease").val() == "1") {
                    layer.msg("选择的计划已发布！");
                    return;
                }
                $.ajax({
                    url: ApiUrl + "CorpPlan/UpdatePlanStatus",
                    type: 'get',
                    cache: false,
                    headers: {
                        "userid": JSON.parse(window.localStorage.authInfo).UserId,
                        "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                    },
                    data: { mark: 'R', value: '1', wherevalue: selectCurrentID },
                    success: function (data) {
                        if (data.StatusCode == 200) {
                            layer.alert("发布成功", { icon: 6 }, function (index) {
                                layer.close(index);
                                location.reload();
                            })
                        }
                        else if (data.StatusCode == 403) {
                            layer.alert(data.Info, function () {
                                location.href = './login.html';
                            })
                        }
                        else {
                            layer.msg(data.Info);
                        }
                    }
                });
                //发布 selectIDs
            });
            //取消发布
            $("#unrelease").click(function () {
                if (selectCurrentID == 0) {
                    layer.msg("请选择要取消发布的计划！");
                    return;
                }
                if ($("#IsRelease").val() == "0") {
                    layer.msg("选择的计划未发布！");
                    return;
                }
                layer.confirm('确定要取消发布吗?', function (index) {
                    //conso.log("已取消发布");

                    $.ajax({
                        url: ApiUrl + "CorpPlan/UpdatePlanStatus",
                        type: 'get',
                        cache: false,
                        headers: {
                            "userid": JSON.parse(window.localStorage.authInfo).UserId,
                            "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                        },
                        data: { mark: 'R', value: "0", wherevalue: selectCurrentID },
                        success: function (data) {
                            if (data.StatusCode == 200) {
                                layer.alert("取消发布成功", { icon: 6 }, function (index) {
                                    layer.close(index);
                                    location.reload();
                                })
                            }
                            else if (data.StatusCode == 403) {
                                layer.alert(data.Info, function () {
                                    location.href = './login.html';
                                })
                            }
                            else {
                                layer.msg(data.Info);
                            }
                        }
                    });

                    layer.close(index);
                    //取消发布 selectIDs
                });
            });


            //获得数据
            function GetFormData() {
                var CPName = $("#CPName").val();//计划名称
                var CPDescribe = $("#CPDescribe").val();
                var StartDateTime = $("#StartDateTime").val();
                var EndDateTime = $("#EndDateTime").val();
                return model = {
                    CPName: CPName,
                    CPDescribe: CPDescribe,
                    StartDateTime: StartDateTime,
                    EndDateTime: EndDateTime,
                    IsRelease: false,
                    IsCheck: false,
                    IsUse: true
                }
            }
            //获得数据
            var cpid;
            function GetFormDataContainTPID() {
                var CPName = $("#CPName").val();//计划名称
                var CPDescribe = $("#CPDescribe").val();
                var StartDateTime = $("#StartDateTime").val();
                var EndDateTime = $("#EndDateTime").val();
                return model = {
                    CPID: cpid,
                    CPName: CPName,
                    CPDescribe: CPDescribe,
                    StartDateTime: StartDateTime,
                    EndDateTime: EndDateTime, 
                    IsRelease: false,
                    IsCheck: false,
                    IsUse: true
                }
            }

            //选择文件
            //选完文件后不自动上传
            upload.render({
                elem: '#test8'
                , url: ApiUrl + "CorpPlan/AddAndFileUpload"
                , headers: {
                    "userid": JSON.parse(window.localStorage.authInfo).UserId,
                    "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                }
                , before: function (obj) {
                    this.data = GetFormDataContainTPID();//携带额外的数据
                    //var index = layer.load(); //开始上传之后打开load层
                }
                , exts: 'jpg|png|gif|bmp|jpeg|doc|docx|xls|xlsx|ppt|pptx'
                , auto: false
                , accept: 'file'
                //,multiple: true
                , bindAction: '#addupload'
                , done: function (res) {
                    console.log(res);
                    if (res.code == 0) { //上传成功

                        //layer.msg("上传成功！");
                    }
                    if (res.code == 601) { //上传成功

                    }
                }
            });


            //$("#add").click(function () {
            //});
            function add()
            {
                if ($("#CPName").val().trim() == "") {
                    layer.msg("请输入计划名称！");
                    return;
                }
                if ($("#StartDateTime").val().trim() == "") {
                    layer.msg("请输入计划起始时间！");
                    return;
                }
                if ($("#CPDescribe").val().trim() == "") {
                    layer.msg("请输入计划描述！");
                    return;
                }
                $.ajax({
                    url: ApiUrl + "CorpPlan/Add",
                    type: 'post',
                    dataType: 'json',
                    data: GetFormData(),
                    headers: {
                        "userid": JSON.parse(window.localStorage.authInfo).UserId,
                        "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                    },
                    success: function (data) {
                        if (data.StatusCode == 200 && data.Count != 0) {
                            cpid = data.Data;
                            $("#addupload").click();
                            layer.alert(data.Info, { icon: 6 }, function (index) {
                                layer.close(index); clearForm();
                                location.reload();
                            })
                        }
                        else if (data.StatusCode == 403) {
                            top.layer.alert(data.Info + ",请重新登录！", { closeBtn: 0 }, function () {
                                top.location.href = "http://" + top.location.host + "/login.html";
                            })
                        }
                        else {
                            layer.msg(data.Info);
                        }
                    }
                });
            }
        });
    </script>
</body>
</html>